package com.myf.entities;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.myf.typeHandlers.JsonbTypeHandler;
import com.myf.typeHandlers.ZonedDateTimeTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;

import java.time.ZonedDateTime;
import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
@TableName(value = "sys_user", autoResultMap = true)
public class UserEntity extends BaseEntity {
    ///  用户Id
    @TableId(type = IdType.AUTO)
    public Integer id;

    /// 用户编号
    public String code;

    ///  用户账号
    public String account;

    /// 姓名
    public String name;

    /// 密码
    public String password;

    /// 性别
    public short gender;

    /// 邮件
    public String email;

    /// 生日
    public Date birthday;

    public short status;

    /// 个性化数据
    @TableField(typeHandler = JsonbTypeHandler.class)
    public String profile;

    @TableField("mobile_no")
    public String modelNo;

    @TableField("last_login_ip")
    public String lastLoginIP;

    @TableField(value = "last_login_at", jdbcType = JdbcType.TIMESTAMP_WITH_TIMEZONE, typeHandler = ZonedDateTimeTypeHandler.class)
    public ZonedDateTime lastLoginAt;
}


